{% extends "../component/_layout.html" %}
{% block content %}
<!-- 面包屑 -->
<div class="bread">
    <div class="wrapper clearfix">
        <a href="/" title="">首页</a><i>&nbsp;&gt;&nbsp;</i>
        {% if article.articleType.parent %}
        <a href="/article/list?name={{article.articleType.parent.name}}&templateType={{ctx.helper.getTemplateTypeByName(article.articleType.parent.name)}}" title="">{{article.articleType.parent.name}}</a><i>&nbsp;&gt;&nbsp;</i>
        {% endif %}
        <a class="type" href="javascript:;" title="">{{article.articleType.name}}</a><i>&nbsp;&gt;&nbsp;</i>
        <a class="title" href="javascript:;" title="">{{ article.title }}</a>
    </div>
</div>
<!-- /面包屑 -->
<!-- 详情页主体 -->
<div class="wrapper">
    <div class="main-news clearfix">
        <div class="main-news-content fl">
            <h2 class="title">{% if article %}{{ article.title }}{%else%}文章不存在或被删除{% endif %}</h2>
            <p class="info">
                <span class="resourse">来源：<i>{% if article.source %}{{ article.source }}{%else%}无来源{% endif %}</i></span>
                <span class="author">作者：<i>{% if article.author %}{{ article.author }}{%else%}未设置{% endif %}</i></span>
                <span class="date">发布时间：<i>{{ ctx.helper.formatDate(article.publish_time, 'YYYY-MM-DD') }}</i></span>
            </p>
            <div class="content">
                {{article.content | safe}}
                {% if ctx.query.video %}
                <div id="video" style="margin-top: 30px;" videoLink="{{article.file.url}}"></div>
                {% endif %}
            </div>
            {% if ctx.query.video %}
            <div class="video-intro">
                <h2 class="video-intro-title">视频介绍</h2>
                <p class="video-intro-content">{{article.attachments_notation}}</p>
            </div>
            {% endif %}
        </div>
        <div class="relative-news fr">
            <h2 class="modal-name">
            {% if ctx.query.video %}
              相关视频
            {%else%}
              相关新闻
            {% endif %}
            </h2>
            <ul class="related-list">
              {% for rel in article.rels %}
                {% if ctx.query.video %}
                <li class="clearfix">
                    <a class="video-img fl" href="/article/detail?articleId={{rel.id}}&video=1" title=""><img src="{{rel.img}}" alt="" width="120" hieght="90"></a>
                    <a class="video-title" href="/article/detail?articleId={{rel.id}}&video=1" title="">{{rel.title}}</a>
                </li>
                {% else %}
                <li><a href="/article/detail?articleId={{rel.id}}" title="">{{rel.title}}</a></li>
                {% endif %}
              {% endfor %}
            </ul>
        </div>
    </div>
</div>
<!-- /详情页主体 -->
{% endblock %} 

{% block script %}
{% if ctx.query.video %}
<script src="/public/front/js/plugins/ckplayer/ckplayer.js"></script>
<script>
    (function(){
        $('video').hide();
        //播放视频
        var videoUrl = $('#video').attr('videoLink');
        var videoFlashvars = { c: 0, p: 0, b: 0, e: 2 };
        var videoPrams = { bgcolor: '#000', allowFullScreen: true, allowScriptAccess: 'always', wmode: 'transparent' };
        videoFlashvars.f = videoUrl;
        CKobject.embedSWF('http://yhkd.99.com/script/plugin/ckplayer/ckplayer.swf', 'video', '', '710', '400', videoFlashvars, videoPrams);
    }())
</script>
{%endif%}
{% endblock %}